/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package javafxclient;

import WSClient.WSClientLugares;
import java.util.List;
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;

/**
 *
 * @author ARMGARCES
 */
public class JavaFXClient extends Application {
    
    @Override
    public void start(Stage primaryStage) {
        Button btn = new Button();
        btn.setText("START!");
        btn.setOnAction(new EventHandler<ActionEvent>() {
            
            @Override
            public void handle(ActionEvent event) {
                testLoadCity();
            }
        });
        
        StackPane root = new StackPane();
        root.getChildren().add(btn);
        
        Scene scene = new Scene(root, 300, 250);
        
        primaryStage.setTitle("Hello World!");
        primaryStage.setScene(scene);
        primaryStage.show();
    }

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        launch(args);
    }    
    
    /***************************************************************************/
    /********************************** TESTS **********************************/
    /***************************************************************************/
    
    private void testFindCity(){
        List<Wsdl.City> cities = WSClientLugares.findCity("aragua");
        System.out.println("RECEIVED");
        if(cities == null){
            System.out.println("NULO");
        }else{
            for (Wsdl.City city : cities) {
                System.out.println("Ciudad: " + city.toString());                                        
            }
        }
        System.out.println("SENT");
    }
    
    private void testLoadCity(){
        List<Wsdl.City> cities = WSClientLugares.loadCity();
        System.out.println("RECEIVED");
        if(cities == null){
            System.out.println("NULO");
        }else{
            for (Wsdl.City city : cities) {
                System.out.println("Ciudad: " + city.toString());                                        
            }
        }
        System.out.println("SENT");
    }

}
